<extend name="common/base"/>

<block name="body">
    <table class="table table-bordered datatable"
           data-toggle="datagrid"
           data-options="{
        id:'id',
        checkAction:'backuptabe|立即备份,optimize|优化,repair|修复',
        width:'100%',
        height:'100%',
        showLinenumber:true,
        selectMult:true,
        showCheckboxcol:true,
        dataUrl:'{:url('getDatas')}',
        local:'remote',
    }"
           >
        <thead>
            <tr>
                <th data-name="name" width="10">名称</th>
                <th data-name="title" width="10">标题</th>
                <th data-name="group" width="10">分组</th>
                <th data-name="type" width="10">类型</th>
                <th data-name="__action__" width="10">操作</th>
            </tr>
        </thead>
        <tbody>
        </tbody>
        <tfoot>
            <tr>
                <th colspan="5"></th>
            </tr>
        </tfoot>
    </table>
</block>

<block name="script">
<script type="text/javascript">
    function getDatas(page) {
        if (!page)
            page = 1;
        var begin = $('#begin').val(),
        end = $('#end').val(),
        max = $('#max').val(),
        min = $('#min').val(),
        title = $('#title').val();
        $.ajax({
            type: 'get',
            url: '{:url("getDatas")}',
            data: {{:config('paginate.var_page')}:page, begin:begin,end:end,max:max,min:min, title: title},
            success: function (data) {
                if (data.total > 0) {
                    var tData = {
                        rows: data.rows,
                        footer: data.pages,
                        pageStart: data.pageStart
                    };
                    //$('table.datatable').datatable('load', tData);
                } else {
                    Do.ready('tips', function () {
                        toastr.error('没有找到合适的记录！');
                    })
                }
            }
        });
    }
</script>
</block>